<?php
/**
 * 文章增加保存功能
 *
 *
 **/
//获取管理员数据
$adminEmail=$_POST['admin_email'];
$adminName= $_POST['admin_name'];
$adminPassword=$_POST['admin_password'];

//保存到数据库
date_default_timezone_set("PRC");

$dsn="mysql:Server=127.0.0.1;dbname=blog";
$db= new PDO($dsn, "root", "123456");
$db ->exec("set names utf8mb4");

$addTime =time();
$updateTime =$addTime;

$sql ="insert into admin (admin_email, admin_name, admin_password, update_time, add_time)
        values ('$adminEmail', '$adminName', '$adminPassword', '$updateTime', '$addTime')";
$result =$db->exec($sql);
var_dump($result);

if($result){
    echo "增加成功。<a href='admin_list.php'>返回列表页面</a>";
    exit();
}else{
    echo "增加失败，错误信息。请联系管理人员：1974289078@qq.com";
}
